package com.wanli.agent.homepage;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.wanli.agent.R;
import com.wanli.agent.base.BaseActivity;
import com.wanli.agent.utils.QRCodeUtil;
import com.wanli.agent.utils.ToastUtil;
import com.wanli.agent.widget.AppTitleBar;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class HelpDetailsActivity extends BaseActivity {

    @BindView(R.id.title_bar)
    AppTitleBar titleBar;
    @BindView(R.id.tv_wifi_account)
    EditText tvWifiAccount;
    @BindView(R.id.tv_wifi_pwd)
    EditText tvWifiPwd;
    @BindView(R.id.tv_commit)
    TextView tvCommit;
    @BindView(R.id.iv_erweima)
    ImageView ivErweima;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_help_details);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.tv_commit)
    public void onViewClicked() {
        String wifiAccount = tvWifiAccount.getText().toString();
        String wifiPwd = tvWifiPwd.getText().toString();
        if (TextUtils.isEmpty(wifiAccount)) {
            ToastUtil.showShort("请输入WiFi账号");
            return;
        }
        if (TextUtils.isEmpty(wifiPwd)) {
            ToastUtil.showShort("请输入WiFi密码");
            return;
        }
        //WIFI:T:WPA;S:"+this.name+";P:"+this.password+";
        Bitmap mBitmap = QRCodeUtil.createQRCodeBitmap("WIFI:T:WPA;S:" + wifiAccount + ";P:" + wifiPwd + ";", 480, 480);
        ivErweima.setImageBitmap(mBitmap);
        ivErweima.setVisibility(View.VISIBLE);
    }
}
